﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Text;
using DAL;
namespace BLL
{
  public  class SetsItemBiz
    {
      SetsItemDao setsItemDao = new SetsItemDao();
      public string GetWageItem(string setsID, string itemName)
      {
          return setsItemDao.GetWageItem(setsID, itemName);
      }
      public string GetItemName(string setsID, string wageItem)
      {
          return setsItemDao.GetItemName(setsID, wageItem);
      }
      //查找最近一个没有使用的编号
      public string  GetFirstItem(string setsID)
      {
          return setsItemDao.GetFirstItem(setsID);
      }

      public string GetEnFormula(string setsID, string cnFormula)
      {
          string result = cnFormula;
          DataTable dt = setsItemDao.GetItemDict(setsID,"all");
          int row=dt.Rows.Count;
          if (row > 0)
          {
              for (int r = 0; r < row; r++)
              {
                  result = result.Replace(dt.Rows[r]["ItemName"].ToString(), dt.Rows[r]["WageItem"].ToString());
              
              }
          
          }

          return result;
      }
      public Hashtable GetFieldsHashTable(string setsID)
      {
          return setsItemDao.GetFieldsHashTable(setsID);
      }
  public DataTable  GetItemDict(string setsID)
    {
        return setsItemDao.GetItemDict(setsID,"part");//不要计算项，只要输入项
  }
  public DataTable GetItemDict(string setsID, string fieldRange)
  {
      return setsItemDao.GetItemDict(setsID, fieldRange);
  }
      //
      public DataTable GetItemList(string setsID)
      {
          return setsItemDao.GetItemList(setsID);
      }

      
    
    }
}
